<template>
	<!-- <view class="">
		1111
	</view> -->
	<view class="flex-col page">
		<view class="flex-col flex-1 group">
			<view class="flex-col">
				<view class="flex-row items-center section_2">
					<view class="flex-col justify-start items-center button"><text class="font text_2">消息通知</text>
					</view>
					<text class="text_3 ml-7">关注公众号，消息提醒更即时~</text>
				</view>
				<image v-if="isShow" @click="tochangshiList" class="image_4 mt-15-5" mode="widthFix" src="https://shops.cg500.com/static/aijiu/banner_new@2x.png" />
				<view class="flex-row mt-15-5">
					<image @click="toFranchise" class="flex-1 image_5"  mode="widthFix"
						src="https://shops.cg500.com/static/aijiu/wyjm@3x.png" />
					<!-- <image @click="buyYiqi" class="ml-10 shrink-0 image_6" src="https://shops.cg500.com/static/aijiu/yiqi@2x.png" /> -->
				</view>
			</view>
			<view class="flex-col group_2 mt-45">
				<view class="flex-row justify-between group_1">
					<text class="text_4">附近门店</text>
					<text class="self-start font text_5">查看全部</text>
				</view>
				<view class="flex-col mt-14-5">
					<view class="flex-col relative list-item mt-14-5" v-for="(item, index) in list" :key="index">
						<!-- <image class="shrink-0 self-center image_7"
							src="https://shops.cg500.com/static/aijiu/listImg.png" /> -->
						<view class="flex-row flex-1 justify-between items-center group_3">
							<view class=" font_2">{{item.name}}</view>
							<view class="flex-row items-center self-stretch group_10">
								<view class="font_3">{{item.address}}</view>
								<image class="shrink-0 image_8 image_9"
									src="https://shops.cg500.com/static/aijiu/map@2x.png" />
								<text class="font_4 text_6">{{item.juli}}</text>
							</view>
						</view>
						<view class="flex-row justify-between" style="margin-top: 20rpx;">
							<view class="font-11">总设备数:{{item.eqCount}}</view>
							<view class="font-11">使用设备数:{{item.isUse}}</view>
							<view class="font-11">闲置设备数:{{item.eqCount - item.isUse}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	// //index.js
	// const app = getApp().globalData;
	// const {
	// 	$Message
	// } = require("../../dist/base/index");
	// var sotk = null;
	// var socketOpen = false;
	// // var wsbasePath = "ws://39.105.123.96:39100";
	// var wsbasePath = "wss://yhz.axu9.com/wss";
	// import iTabBar from "../../dist/tab-bar/index";
	// import iTabBarItem from "../../dist/tab-bar-item/index";
	// import iProgress from "../../dist/progress/index";
	// import iButton from "../../dist/button/index";
	// import iModal from "../../dist/modal/index";
	// import nsLogin from "../../components/ns-login/ns-login.vue"
	// import auth from 'common/js/auth.js';
	const app = getApp().globalData;
	export default {
		components: {},
		props: {},
		data() {
			return {
				list: [],
				page: 1,
				total: 0,
				isShow: true
			};
		},
		onLoad() {
			this.getShopList()
		},
		onShow() {
			this.getConfig();
			
		},
		onReachBottom() {
			console.log('触底了')
			if(this.page < this.total) {
				this.page++
				this.getShopList()
			}else {
				uni.showToast({
					title: '暂无更多数据',
					icon: 'none'
				})
			}
		},
		methods: {
			getConfig(){
				var _this = this;
				uni.request({
					url: app.post_url + '/aijiu/api.Equipment/zhanshi',
					//仅为示例，并非真实的接口地址
					data: {},
					method: 'post',
					success(res) {
						if(res.data.data == 1){
							_this.isShow = false
						}
						
					}
				
				});
			},
			getShopList: function() {
				var _this = this;
				let user_id = uni.getStorageSync('userId')
				uni.request({
					url: app.post_url + '/aijiu/api.Shop/shopList',
					//仅为示例，并非真实的接口地址
					data: {
						page: this.page
					},
					method: 'post',

					success(res) {
						_this.list = [..._this.list,...res.data.data.list]
						_this.total = res.data.data.page.pages
						console.log(_this.list);
					}

				});
			},
			toFranchise() {
				let userId = uni.getStorageSync('userId')
				if(!userId){
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					})
					return
				}
				uni.navigateTo({
					url: '/pages/franchise/franchise'
				})
			},
			buyYiqi(){
				uni.showToast({
					title: '敬请期待',
					icon: 'none'
				})
			},
			tochangshiList(){
				uni.navigateTo({
					url: '/pages/shop/commonSense/index'
				})
			}

		},
	};
</script>
<style>
	@import "@/common/css/common.css";

	.ml-7 {
		margin-left: 14rpx;
	}

	.mt-15-5 {
		margin-top: 31rpx;
	}

	.mt-45 {
		margin-top: 90rpx;
	}

	.mt-14-5 {
		margin-top: 29rpx;
	}

	.ml-11-5 {
		margin-left: 23rpx;
	}

	.mt-16-5 {
		margin-top: 33rpx;
	}

	.mt-3-5 {
		margin-top: 7rpx;
	}

	.page {
		background-color: #f8f8f8;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		height: 100%;
	}

	.group {
		padding: 19rpx 29rpx 80rpx 30rpx;
		overflow-y: auto;
	}

	.section_2 {
		margin: 0 6rpx;
		background-color: #ffffff;
		border-radius: 30rpx;
	}

	.button {
		padding: 19rpx 0 18rpx;
		background-color: #ffe0b4;
		border-radius: 30rpx;
		width: 154rpx;
		height: 60rpx;
	}

	.font {
		font-size: 24rpx;
		font-family: PingFang SC;
		line-height: 22rpx;
		font-weight: 500;
	}

	.text_2 {
		color: #151515;
		line-height: 23rpx;
	}

	.text_3 {
		color: #151515;
		font-size: 22rpx;
		font-family: PingFang SC;
		line-height: 22rpx;
	}

	.image_4 {
		width: 692rpx;
	}

	.image_5 {
		width: 692rpx;
	}

	.image_6 {
		width: 250rpx;
		height: 240rpx;
	}

	.group_2 {
		padding: 0 15rpx;
	}

	.group_1 {
		padding: 0 2rpx;
	}

	.text_4 {
		color: #151515;
		font-size: 40rpx;
		font-family: HYDaSongJ;
		line-height: 38rpx;
	}

	.text_5 {
		margin-right: 4rpx;
		color: #888888;
		line-height: 23rpx;
	}

	.list-item {
		padding: 33rpx 31rpx 34rpx;
		background-color: #ffffff;
		box-shadow: 0rpx 0rpx 12.34rpx 0.66rpx #cddddb14;
		border-radius: 16rpx;
	}

	.list-item:first-child {
		margin-top: 0;
	}

	.image_7 {
		border-radius: 8rpx;
		width: 114rpx;
		height: 114rpx;
	}

	.group_3 {
		margin-right: 4rpx;
		margin-top: 6rpx;
	}

	.font_2 {
		font-size: 32rpx;
		font-family: PingFang SC;
		line-height: 31rpx;
		font-weight: 500;
		color: #151515;
	}

	.group_10 {
		padding-left: 2rpx;
	}

	.font_3 {
		font-size: 26rpx;
		font-family: PingFang SC;
		line-height: 25rpx;
		color: #836c4f;
	}

	.image_8 {
		width: 15rpx;
		height: 18rpx;
	}

	.image_9 {
		margin-left: 15rpx;
	}

	.font_4 {
		font-size: 22rpx;
		font-family: PingFang SC;
		line-height: 17rpx;
		color: #836c4f;
	}

	.text_6 {
		margin-left: 3rpx;
	}

	.tab-bar {
		padding: 14rpx 68rpx 22rpx;
		/* background-image: url('https://ide.code.fun/api/image?token=66011138731c75001101ea22&name=f7a344d790cb4716a2a1e4b971245b8d.png'); */
		background-size: 100% 100%;
	}

	.group_6 {
		height: 83rpx;
	}

	.image_11 {
		width: 54rpx;
		height: 54rpx;
	}

	.font_5 {
		font-size: 22rpx;
		font-family: PingFang SC;
		line-height: 21rpx;
		color: #836c4f;
	}

	.text_7 {
		line-height: 22rpx;
	}

	.group_7 {
		height: 81.5rpx;
	}

	.text_8 {
		line-height: 20rpx;
	}
	.font-11 {
		font-size: 26rpx;
		color: #888888;
	}
</style>